<?php
include_once 'class_master/salles.class.php';

class parcourir
{
	function __construct()
	{
		
	}
	
	public function get_unique($req)
	{
		while ($row = $req->fetch())
		{
			return $sortie1 = $row[0];
		}
	}


public function get_uniques($req)
	{
		while ($row = $req->fetch())
		{
			return $sortie1 = $row[0].$row[1];
		}
	}
	
	

	public function get_salle($req)
	{
		$sortie = array();
		while ($row = $req->fetch())
		{
			array_push($sortie,$row[0],$row[1],$row[2]);
		}
		return $sortie;
	}
	
	
	public function get_salles($req)
	{

		$donnees = $req->fetchAll();
 		//On parcourt tous les enregistrements
		foreach($donnees as $row)
		{
		    //On affiche l'id et le nom du client
    		echo $row['id_salle'];
    		echo $row['nom_salle'];
    		echo $row['status'];
		}
		
	}
	
	public function get_array_salle()
	{
		
		$toto = new db();
		
		$req = $toto->select_all('salle');
		
		$sortie = array();
		
		$row = $req->fetchall();
		
		foreach ($row as $salle)
		{	
			$salle = new salle();
			$salle->set_id_salle($row[0]);
			$salle->set_nom_salle($row[1]);
			$salle->set_status_salle($row[2]);
			array_push($sortie, $salle);
			
		}
		
		return $sortie;
	}
	
	public function get_array_machine($req)
	{
		$sortie = array();
		$row = $req->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);
		foreach ($row as $machine)
		{
			$machine = new machine();
			array_push($sortie, $machine);
				
		}
		return $sortie;
	}
	
}